package com.woniuxy.store.core.service.impl;

import com.woniuxy.store.core.model.PmMessage;
import com.woniuxy.store.core.mapper.PmMessageMapper;
import com.woniuxy.store.core.service.PmMessageService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author gmx
 * @since 2021-07-06
 */
@Service
public class PmMessageServiceImpl extends ServiceImpl<PmMessageMapper, PmMessage> implements PmMessageService {
    @Resource
    PmMessageMapper messageMapper;
    @Override
    public List<PmMessage> selectAnnouncementMessage() {
        return messageMapper.selectAnnouncementMessage();
    }

    @Override
    public List<PmMessage> selectNotification(Integer storeId) {
        return messageMapper.selectNotification(storeId);
    }

    @Override
    public List<PmMessage> selectEventNotification() {
        return messageMapper.selectEventNotification();
    }

    @Override
    public int postAMessage(Integer storeId) {
        PmMessage message = new PmMessage();
        message.setMessage("加盟成功");
        message.setCreateTime(new Date());
        message.setStoreId(storeId);
        message.setType(1);
        return messageMapper.postAMessage(message);
    }
}
